﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.validasinpwp" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Transaction;
using SIPO.Library.DomainObject.Transaction;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
using System.Text;

namespace SIPO.Web.AjaxHandler.Loaddata
{

    public class validasinpwp : SIPO.Web.BaseHandler
    {
        recRegistrationRepo recRegistrationDal = new recRegistrationRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);
            string npwp = context.Request.Params["npwp"].Trim();
            string sector = string.Empty;
            string subsector = string.Empty;
            string subsubsector = string.Empty;
            List<recRegistration> registration = recRegistrationDal.GetByNPWPs(npwp);
            //registration = recRegistrationDal.GetByNPWPs(npwp);
            //if (registration != null)
            //{
            //sector = registration.recSector.SectorName;
            //subsector = registration.recSubSector.SubSectorName;
            //subsubsector = registration.recSubSubSector.SubSubSectorName;
            var result = registration;
            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            //}

            //StringBuilder sbProject = new StringBuilder();
            //sbProject.Append("{");
            //sbProject.AppendFormat("  {0}Sector{0}:{0}{1}{0}", "\"", sector);
            //sbProject.Append(",");
            //sbProject.AppendFormat("  {0}SubSector{0}:{0}{1}{0}", "\"", subsector);
            //sbProject.Append(",");
            //sbProject.AppendFormat("  {0}SubSubSector{0}:{0}{1}{0}", "\"", subsubsector);
            //sbProject.Append("}");

            //context.Response.Write(sbProject.ToString());

        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}